package com.imc.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.imc.dao.StaffDao;
import com.imc.domain.Staff;
import com.imc.persistence.CustomHibernateDaoSupport;


@Repository("staffDao")
public class StaffDaoImpl extends CustomHibernateDaoSupport implements StaffDao {

	
	public void delete(Staff staff) {
		getHibernateTemplate().delete(staff);
		
	}

	@SuppressWarnings("unchecked")

	public Staff findByStaffId(long staffId) {
		List<Staff> list =(List<Staff>) getHibernateTemplate().find(
                "from Person where stockCode=?",staffId
        );
		return (Staff)list.get(0);
	}


	public void save(Staff staff) {
		getHibernateTemplate().save(staff);
		
	}

	
	public void update(Staff staff) {
		getHibernateTemplate().update(staff);
		
	}

}
